﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using OboutInc.Window;
using E2_WEBSITE.Code.Product;
using Obout.Grid;

public partial class Product : System.Web.UI.Page
{
    private ProductController m_productController = new ProductController();

    protected void Page_Load(object sender, EventArgs e)
    {
        string sProductId = Request.QueryString["CategoryId"];
        if (sProductId == null)
        {
            Response.Redirect("Default.aspx");
        }

        if (!Page.IsPostBack)
        {
            DataBindingListProduct();

            Window myWindow = this.Master.FindControl("ContentPlaceHolder1").FindControl("myWindow") as Window;
            myWindow.PageOpacity = 30;
            myWindow.IsDraggable = false;
            myWindow.IsResizable = false;

        }        
    }

    protected void DataBindingListProduct()
    {
        Grid grid1 = this.Master.FindControl("ContentPlaceHolder1").FindControl("grid1") as Grid;

        string sCategoryId = string.Empty;
        sCategoryId = Request.QueryString["CategoryId"];
        if (sCategoryId != string.Empty)
        {
            grid1.DataSource = m_productController.getTableProductByCategory(int.Parse(sCategoryId));
            grid1.DataBind();
            //grid1.TemplateControl.
        }
    }
}